Skip to content

Paper-Manu #72

Open
kmanuponce wants to merge 10 commits into
Ada-C15:masterfrom
kmanuponce:master
Open

Paper-Manu #72
kmanuponce wants to merge 10 commits into
Ada-C15:masterfrom
kmanuponce:master

Conversation

@kmanuponce

Copy link
Copy Markdown

Updating all endpoints to pass all test Waves

@kaidamasaki kaidamasaki left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

I like that you split your routes file into goal_routes.py and task_routes.py. 😄

There were a few small things but overall everything looked great! Well done!

Comment thread app/goal_routes.py
def handle_goal(goal_id):
goal = Goal.query.get(goal_id)

if goal == None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember, None is falsey:

Suggested change
if goal == None:
if not goal:

Comment thread app/goal_routes.py
if goal == None:
return "",404

# goal.completed_at = None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a minor thing but it's an industry best practice to remove commented in code before you submit a PR so is a good habit to get into. 😄

Comment thread app/goal_routes.py
return {
"id": goal.goal_id,
"title": goal.title,
"tasks": [task.get_json() for task in goal.tasks]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List comprehension! 😄

Comment thread app/models/task.py
Comment on lines +16 to +21
completed_at = self.completed_at
if completed_at == None:
is_complete = False
else:
is_complete = True
return is_complete

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified to:

Suggested change
completed_at = self.completed_at
if completed_at == None:
is_complete = False
else:
is_complete = True
return is_complete
return self.completed_at != None

Comment thread app/routes.py
Comment on lines +20 to +30
if task.completed_at == None:
completed_at = False
else:
completed_at = True

tasks_response.append({
"id": task.task_id,
"title": task.title,
"description": task.description,
"is_complete": completed_at
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not clear on why you didn't use task.get_json here.

@kmanuponce

kmanuponce commented May 21, 2021 via email

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants